home *** CD-ROM | disk | FTP | other *** search
/ PCMania 56 / PCMania CD56_1.iso / abc.z / MENU.FRM < prev    next >
Text File  |  1996-12-16  |  5KB  |  174 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Menus DEMO"
  6.    ClientHeight    =   2550
  7.    ClientLeft      =   795
  8.    ClientTop       =   1530
  9.    ClientWidth     =   3975
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   0
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   2955
  21.    Icon            =   "MENU.frx":0000
  22.    Left            =   735
  23.    LinkTopic       =   "Form1"
  24.    ScaleHeight     =   2550
  25.    ScaleWidth      =   3975
  26.    Top             =   1185
  27.    Width           =   4095
  28.    Begin VB.PictureBox Picture1 
  29.       Appearance      =   0  'Flat
  30.       BackColor       =   &H80000005&
  31.       BorderStyle     =   0  'None
  32.       ForeColor       =   &H80000008&
  33.       Height          =   495
  34.       Left            =   255
  35.       Picture         =   "MENU.frx":030A
  36.       ScaleHeight     =   495
  37.       ScaleWidth      =   495
  38.       TabIndex        =   3
  39.       Top             =   915
  40.       Width           =   495
  41.    End
  42.    Begin AbcflowLib.ABC ABC1 
  43.       Height          =   615
  44.       Left            =   0
  45.       TabIndex        =   4
  46.       Top             =   1440
  47.       Width           =   615
  48.       _version        =   65536
  49.       _extentx        =   1085
  50.       _extenty        =   1085
  51.       _stockprops     =   1
  52.    End
  53.    Begin VB.Label Label3 
  54.       Appearance      =   0  'Flat
  55.       BackColor       =   &H80000005&
  56.       Caption         =   "(c) Micrografx Inc., 1995. All Rights Reserved."
  57.       ForeColor       =   &H80000008&
  58.       Height          =   390
  59.       Left            =   885
  60.       TabIndex        =   0
  61.       Top             =   990
  62.       Width           =   3000
  63.    End
  64.    Begin VB.Label Label1 
  65.       Appearance      =   0  'Flat
  66.       BackColor       =   &H80000005&
  67.       Caption         =   "When this VB program is running, a new menu is added to ABC. The menu adds object counting functionality to ABC."
  68.       ForeColor       =   &H80000008&
  69.       Height          =   615
  70.       Left            =   240
  71.       TabIndex        =   2
  72.       Top             =   120
  73.       Width           =   3495
  74.    End
  75.    Begin VB.Label Label2 
  76.       Appearance      =   0  'Flat
  77.       BackColor       =   &H80000005&
  78.       Caption         =   "<---- Double-click on this custom OCX in VB 4.0 edit mode to see the event handling code."
  79.       ForeColor       =   &H80000008&
  80.       Height          =   855
  81.       Left            =   720
  82.       TabIndex        =   1
  83.       Top             =   1560
  84.       Visible         =   0   'False
  85.       Width           =   3015
  86.    End
  87. End
  88. Attribute VB_Name = "Form1"
  89. Attribute VB_Creatable = False
  90. Attribute VB_Exposed = False
  91. Dim ABC As Object
  92.  
  93. Const SHAPECOUNT = "Shape Count..."
  94. Const LINECOUNT = "Line Count..."
  95.  
  96. Private Sub ABC1_AppMenuSUBCLASS(ByVal MenuItem As Object, Override As Boolean)
  97.     ABC.HourGlass = True
  98.     If MenuItem = SHAPECOUNT Then
  99.         CountShapes
  100.     ElseIf ABC1.MenuItem = LINECOUNT Then
  101.         CountLines
  102.     End If
  103.     ABC.HourGlass = False
  104. End Sub
  105.  
  106. Private Sub ABC1_AppQuitNOTIFY()
  107.     End
  108. End Sub
  109.  
  110. Private Sub CountLines()
  111.     Dim Objects As Object, Obj As Object
  112.  
  113.     Lines = 0
  114.     Set Objects = ABC.ActiveChart.Objects
  115.  
  116.     Do
  117.         Set Obj = Objects.ItemFromAll
  118.         If Obj.Valid And Obj.Type = 1 Then
  119.             Lines = Lines + 1
  120.         End If
  121.     Loop While Obj.Valid
  122.  
  123.     If Lines = 0 Then
  124.         Message = "There are no lines in this chart."
  125.     ElseIf Lines = 1 Then
  126.         Message = "There is one line in this chart."
  127.     Else
  128.         Message = "There are " & Lines & " lines in this chart."
  129.     End If
  130.  
  131.     ABC.MsgBox Message
  132. End Sub
  133.  
  134. Private Sub CountShapes()
  135.     Dim Objects As Object, Obj As Object
  136.  
  137.     Shapes = 0
  138.     Set Objects = ABC.ActiveChart.Objects
  139.  
  140.     Do
  141.         Set Obj = Objects.ItemFromAll
  142.         If Obj.Valid And Obj.Type = 0 Then
  143.             Shapes = Shapes + 1
  144.         End If
  145.     Loop While Obj.Valid
  146.  
  147.     If Shapes = 0 Then
  148.         Message = "There are no shapes in this chart."
  149.     ElseIf Shapes = 1 Then
  150.         Message = "There is one shape in this chart."
  151.     Else
  152.         Message = "There are " & Shapes & " shapes in this chart."
  153.     End If
  154.  
  155.     ABC.MsgBox Message
  156. End Sub
  157.  
  158. Private Sub Form_Load()
  159.     Dim Menu As Object
  160.  
  161.     Set ABC = CreateObject("ABCFlow.application")
  162.     ABC.Visible = True
  163.  
  164.     ' Get the ABC Quit event so the Menu
  165.     ' sample can unload when ABC Quits
  166.     ABC.RegisterEvent ABC1, Form1.Caption, "AppQuitNOTIFY"
  167.  
  168.     Set Menu = ABC.AddMenu("Stats", ABC1, Form1.Caption)
  169.     Menu.AppendItem SHAPECOUNT
  170.     Menu.AppendItem LINECOUNT
  171.     Form1.WindowState = 1   ' Minimize Menu Sample Form
  172. End Sub
  173.  
  174.